package com.aabte.design.pattern.behavioral.observer;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Observable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Course extends Observable {

    private String courseName;

    public void produceQuestion(Course course, Question question){
        System.out.println(question.getUserName()+ "在"+ course.getCourseName()+"上提交了一个问题");
        // 修改状态
        setChanged();
        // 通知观察者
        notifyObservers(question);
    }


}
